/**
 * 
 */
package ve.com.neometrica.inventario.web.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

import org.apache.log4j.Logger;

import ar.com.excle.commons.web.faces.UtilFaces;
import ve.com.neometrica.inventario.util.Constants;

/**
 * @author acabrera
 *
 */
@ManagedBean(name="menuBean")
@SessionScoped
public class MenuBean extends AdministrarBean {

	Logger log = Logger.getLogger(MenuBean.class);
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public MenuBean() {
		// TODO Auto-generated constructor stub
	}
	 
	@Override
	protected void init() {
		// TODO Auto-generated method stub
		super.init();
	}
	
	 public String nuevoProducto() {
		if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("productoBean") != null) {
	            UtilFaces.resetManagedBean("productoBean");
	    }
		 return Constants.OUTCOME_PRODUCTO;
	 }
	 
	 public String listaProducto() {
		 if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("listaProductoBean") != null) {
	            UtilFaces.resetManagedBean("listaProductoBean");
	    }
		 return Constants.OUTCOME_LISTA_PRODUCTO;
	 }
	 
	 public String nuevoInventario() {
		 if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("inventarioBean") != null) {
	            UtilFaces.resetManagedBean("inventarioBean");
	    }
		 return Constants.OUTCOME_INVENTARIO;
	 }
	 
	 public String listaInventario() {
		 if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("listaInventarioBean") != null) {
	            UtilFaces.resetManagedBean("listaInventarioBean");
	    }
		 return Constants.OUTCOME_LISTA_INVENTARIO;
	 }
	 

	 public String nuevaTransaccion() {
		 if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("transaccionBean") != null) {
	            UtilFaces.resetManagedBean("transaccionBean");
	    }
		 return Constants.OUTCOME_TRANSACCION;
	 }
	 
	 public String listaTransaccion() {
		 if(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("listaTransaccionBean") != null) {
	            UtilFaces.resetManagedBean("listaTransaccionBean");
	    }
		 return Constants.OUTCOME_LISTA_TRANSACCION;
	 }
}
